package com.cqw.commontest.thread.unit5;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-06-08 11:08
 * @Description: JUC 工具类
 */
public class Test2 {

    public static void main(String[] args) {
        int[] productIds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

        List<ProductPrice> list = Arrays.stream(productIds).mapToObj(ProductPrice::new).collect(Collectors.toList());

    }


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ToString
    private static class ProductPrice {
        private int productId;

        private double price;

        public ProductPrice(int productId) {
            this.productId = productId;
        }
    }
}



